Fix #131869:
authorMatthias Clasen <maclas@gmx.de>
Wed, 21 Jan 2004 22:26:53 +0000 (22:26 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 21 Jan 2004 22:26:53 +0000 (22:26 +0000)
Wed Jan 21 23:27:14 2004  Matthias Clasen  <maclas@gmx.de>

Fix #131869:

* gtk/gtkaction.c (_gtk_action_emit_activate): Hold
a reference to the group while emitting the signals.

* gtk/gtkactiongroup.c (gtk_action_group_init): Use a
destroy notify which does not only unref, but also resets
the action_group property of the action.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkaction.c
gtk/gtkactiongroup.c

index cccdf2e19eb2f8b04fd24d456001b67fcaaef6e9..a74d6da328a18f0d0be30869375ab695693fbf12 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Wed Jan 21 23:27:14 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fix #131869: 
+       
+       * gtk/gtkaction.c (_gtk_action_emit_activate): Hold
+       a reference to the group while emitting the signals.
+
+       * gtk/gtkactiongroup.c (gtk_action_group_init): Use a 
+       destroy notify which does not only unref, but also resets
+       the action_group property of the action.
+
 2004-01-20  Federico Mena Quintero  <federico@ximian.com>
 
        * NEWS: Added details about GtkFileChooser changes.
index cccdf2e19eb2f8b04fd24d456001b67fcaaef6e9..a74d6da328a18f0d0be30869375ab695693fbf12 100644 (file)
@@ -1,3 +1,14 @@
+Wed Jan 21 23:27:14 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fix #131869: 
+       
+       * gtk/gtkaction.c (_gtk_action_emit_activate): Hold
+       a reference to the group while emitting the signals.
+
+       * gtk/gtkactiongroup.c (gtk_action_group_init): Use a 
+       destroy notify which does not only unref, but also resets
+       the action_group property of the action.
+
 2004-01-20  Federico Mena Quintero  <federico@ximian.com>
 
        * NEWS: Added details about GtkFileChooser changes.
index cccdf2e19eb2f8b04fd24d456001b67fcaaef6e9..a74d6da328a18f0d0be30869375ab695693fbf12 100644 (file)
@@ -1,3 +1,14 @@
+Wed Jan 21 23:27:14 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fix #131869: 
+       
+       * gtk/gtkaction.c (_gtk_action_emit_activate): Hold
+       a reference to the group while emitting the signals.
+
+       * gtk/gtkactiongroup.c (gtk_action_group_init): Use a 
+       destroy notify which does not only unref, but also resets
+       the action_group property of the action.
+
 2004-01-20  Federico Mena Quintero  <federico@ximian.com>
 
        * NEWS: Added details about GtkFileChooser changes.
index cccdf2e19eb2f8b04fd24d456001b67fcaaef6e9..a74d6da328a18f0d0be30869375ab695693fbf12 100644 (file)
@@ -1,3 +1,14 @@
+Wed Jan 21 23:27:14 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fix #131869: 
+       
+       * gtk/gtkaction.c (_gtk_action_emit_activate): Hold
+       a reference to the group while emitting the signals.
+
+       * gtk/gtkactiongroup.c (gtk_action_group_init): Use a 
+       destroy notify which does not only unref, but also resets
+       the action_group property of the action.
+
 2004-01-20  Federico Mena Quintero  <federico@ximian.com>
 
        * NEWS: Added details about GtkFileChooser changes.
index cccdf2e19eb2f8b04fd24d456001b67fcaaef6e9..a74d6da328a18f0d0be30869375ab695693fbf12 100644 (file)
@@ -1,3 +1,14 @@
+Wed Jan 21 23:27:14 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Fix #131869: 
+       
+       * gtk/gtkaction.c (_gtk_action_emit_activate): Hold
+       a reference to the group while emitting the signals.
+
+       * gtk/gtkactiongroup.c (gtk_action_group_init): Use a 
+       destroy notify which does not only unref, but also resets
+       the action_group property of the action.
+
 2004-01-20  Federico Mena Quintero  <federico@ximian.com>
 
        * NEWS: Added details about GtkFileChooser changes.
index e54e3ba87ed3c755bf1bbe43882199d002dc6699..7c5a2076eb061c477b823d4fe59cd6caba14f3ad 100644 (file)
@@ -957,13 +957,19 @@ _gtk_action_emit_activate (GtkAction *action)
 {
   GtkActionGroup *group = action->private_data->action_group;
 
-  if (group != NULL)
-    _gtk_action_group_emit_pre_activate (group, action);
+  if (group != NULL) 
+    {
+      g_object_ref (group);
+      _gtk_action_group_emit_pre_activate (group, action);
+    }
 
     g_signal_emit (action, action_signals[ACTIVATE], 0);
 
-  if (group != NULL)
-    _gtk_action_group_emit_post_activate (group, action);
+  if (group != NULL) 
+    {
+      _gtk_action_group_emit_post_activate (group, action);
+      g_object_unref (group);
+    }
 }
 
 /**
index 1b383245a24e0f9e1d23170ff4a0ff6e1d41d9f1..72ff6e4dfa7af6795d5aedf63985d6135d703c0c 100644 (file)
@@ -246,6 +246,14 @@ gtk_action_group_class_init (GtkActionGroupClass *klass)
   g_type_class_add_private (gobject_class, sizeof (GtkActionGroupPrivate));
 }
 
+
+static void 
+remove_action (GtkAction *action) 
+{
+  g_object_set (action, "action_group", NULL, NULL);
+  g_object_unref (action);
+}
+
 static void
 gtk_action_group_init (GtkActionGroup *self)
 {
@@ -255,7 +263,7 @@ gtk_action_group_init (GtkActionGroup *self)
   self->private_data->visible = TRUE;
   self->private_data->actions = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                       (GDestroyNotify) g_free,
-                                                      (GDestroyNotify) g_object_unref);
+                                                      (GDestroyNotify) remove_action);
   self->private_data->translate_func = NULL;
   self->private_data->translate_data = NULL;
   self->private_data->translate_notify = NULL;
@@ -609,7 +617,6 @@ gtk_action_group_remove_action (GtkActionGroup *action_group,
   /* extra protection to make sure action->name is valid */
   g_object_ref (action);
   g_hash_table_remove (action_group->private_data->actions, gtk_action_get_name (action));
-  g_object_set (G_OBJECT (action), "action_group", NULL, NULL);
   g_object_unref (action);
 }